import { shallowEqual, useDispatch, useSelector } from "react-redux"
import { add, minus, getAsyncInfo } from "./store"

function ReduxHookPage() {

    const { count } = useSelector((state: any) => ({...state.count}), shallowEqual)
    const dispatch = useDispatch()

    return (
        <>
            <h2>redux hook page</h2>
            <div>this is count:{count}</div>
            <button onClick={() => { dispatch(add()) }}>add</button>
            <button onClick={() => { dispatch(minus()) }}>minus</button>
            <button onClick={() => { dispatch((getAsyncInfo as any)()) }}>getAsyncInfo</button>
        </>
    )
}

export default ReduxHookPage
